<script setup lang="ts">
//简单的数据如何变成响应式
import { ref } from "vue";
//ref返回一个对象，所包含的简单类型数据保存在value中
const score = ref(100)
console.log(score.value);//在ts中必须.value来对值进行操作
const changeScore = () => { 
    score.value++
}
const person = ref({
    name: '不知火舞',
    age:5
})
const changeAge = () => { 
    person.value.age++
}

</script>
<template>
    <div>成绩：{{ score }}</div>
    <button @click="changeScore">修改成绩</button>
    <div>人物介绍：{{ person }}</div>
    <button @click="changeAge">修改年龄</button>
</template>

